package com.itheima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.health.pojo.CheckItem;
import com.itheima.health.pojo.Setmeal;
//import org.apache.dubbo.config.annotation.Service;
import com.itheima.health.vo.CheckGroupVO;
import com.itheima.health.vo.SetmealVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * @program: health_paret
 * @description:
 * @author: Mr.Wang
 * @create: 2020-11-07 21:28
 **/
public interface SetmealMapper extends BaseMapper<Setmeal> {
    @Delete("delete from T_SETMEAL_CHECKGROUP where SETMEAL_ID= #{sid}")
    void deletezhongjian(Integer sid);

    @Insert("insert into T_SETMEAL_CHECKGROUP values (#{sid},#{gid})")
    void addCheckGroupandSetmeal(@Param("sid") Integer sid, @Param("gid") Integer gid);

    @Select("select checkgroup_id from T_SETMEAL_CHECKGROUP where setmeal_id=#{sid}")
    int[] findCheckgroupid(int sid);


    @Select("select sex,img,age,name,remark from t_setmeal where id = #{id}")
    SetmealVO findSetmealByid(@Param("id") int id);

    @Select("select tc.id,tc.name,tc.remark from t_setmeal_checkgroup tsc , t_checkgroup tc where tsc.checkgroup_id=tc.id and tsc.setmeal_id =#{id}")
    List<CheckGroupVO> findCheckGroupInfoSetmeal(@Param("id") int id);

    @Select("select tc.name from t_checkgroup_checkitem tcc,t_checkitem tc where tcc.checkitem_id =tc.id and tcc.checkgroup_id=#{checkGroupind}")
    List<CheckItem> findCheckItemInfoCheckGroup(@Param("checkGroupind") Integer checkGroupind);
}
